function simplify_ERPs_for_R()

chans2plot = 'Fz';
% chans2plot = {'FCz','Fz','Cz','FC1','FC2'};

compname = getenv('computername');

if strcmp(compname,'DESKTOP-BHR0AU7')
    loaddir = 'E:\ANL\Experiments\RESULTS\VAST\EEG\';
    savedir = 'E:\ANL\Experiments\RESULTS\VAST\DATAforR\';
    addpath('C:\Users\jtjus\Documents\MATLAB\fieldtrip-20180512\fieldtrip-20180512');
    addpath(genpath('E:\MATLAB\CSDtoolbox'));
elseif strcmp(compname,'MSI')
    loaddir = 'E:\ANL\RESULTS\VAST\EEG\';
    savedir = 'E:\ANL\RESULTS\VAST\DATAforR\';
    addpath('D:\MATLAB\fieldtrip-20180809\fieldtrip-20180809');
    addpath(genpath('D:\MATLAB\CSDtoolbox'));
else
    error('need to set up paths for this machine.')
end

% find channel(s) of interest 
temp = load('dummy_indSs.mat');
fakeERP = temp.dummy_indSs;
chanLoc = ismember(fakeERP.label, chans2plot);

temp = load(strcat(loaddir,'avg_eachERP.mat'));
avg = temp.avg;
sem = temp.sem;
clear temp

keyconds = {'at_at','as_at','vt_at','vs_at','at_as','as_as','vt_as','vs_as'};
[int1_avg, int1_sem] = deal([keyconds; cell(1,length(keyconds))]);

for c = 1:length(keyconds)
    % Average
    curravg = avg{2,strcmp(avg(1,:),keyconds{c})}; % scope to condition
    curravg = curravg{2,strcmp(curravg(1,:),'int_s1')}; % ERP of interest 
    int1_avg{2,c} = curravg(chanLoc,:);
    if size(int1_avg{2,c}, 1) > 1 % more than one channel selected
        int1_avg{2,c} = mean(int1_avg{2,c}, 1);
    end
    % SEM
    currsem = sem{2,strcmp(sem(1,:),keyconds{c})};
    currsem = currsem{2,strcmp(currsem(1,:),'int_s1')};
    int1_sem{2,c} = currsem(chanLoc,:);
    if size(int1_sem{2,c}, 1) > 1 % more than one channel selected
        int1_sem{2,c} = mean(int1_sem{2,c}, 1);
    end
end

% Package a timebase with this
temp = load('dummy_indSs.mat');
tb = temp.dummy_indSs.time; % already adjusted for 100ms baseline

save(strcat(savedir,'avg_int1_ERP.mat'), 'int1_avg', 'int1_sem', 'tb')